Full source code website bán hàng thương mại điện tử gần giống shopee
468.969 lượt xem;
1 <table height="28" cellSpacing="0" cellPadding="0" width="100%" border="0">
2 <tr align=center>
3 <td class="title" width="100%" height="17">
4 Sản phẩn bán chạy : </td>
5 </tr>
6 </table>
7 <?
8 switch ($_GET['action'])
9 {
10 case 'del' :
11 $id = $_GET['id'];
12 $sql = "delete from pro_saleoff where pro_id='".$id."'";
13 @$result = mysql_query($sql,$con);
14 if ($result) echo "<p align=center class='err'>Đã xóa thành công</p>";
15 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
16 break;
17 }
18 ?>
19
20 <?
21 if (isset($_POST['ButDel'])) {
22 $cnt=0;
23 foreach ($_POST['chk'] as $id)
24 {
25 @$result = mysql_query("delete from pro_saleoff where pro_id='".$id."'",$con);
26 if ($result) $cnt++;
27 }
28 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
29 }
30 ?>
31 <?
32 $page = $_GET["page"];
33 $p=0;
34 if ($page!='') $p=$page;
35 ?>
36 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
37 <input type=hidden name="page" value="<? echo $page; ?>">
38 <?
39 function taotrang($sql,$link,$nitem,$itemcurrent)
40 { global $con;
41 $ret="";
42 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
43 $value = mysql_fetch_array($result);
44 $plus = (($value['cnt'] % $nitem)>0);
45 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
46 {
47 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
48 else $ret .= ($i+1)." ";
49 }
50 return $ret;
51 }
52 $pageindex=taotrang("select count(*) from pro_saleoff ","./?act=pro_saleoff&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
53 ?>
54
55 <table cellspacing="0" cellpadding="0" width="100%">
56 <? if ($_REQUEST['code']==1) echo '<tr><td colspan="2" align="center" class="err">Đã cập nhật thành công</td></tr>'; ?>
57 <tr>
58 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
59 </tr>
60 </table>
61
62 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
63 <tr>
64 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
65 <td nowrap class="title"> </td>
66 <td nowrap class="title"> </td>
67 <td align="center" nowrap class="title"><b>Mã </b></td>
68 <td align="center" nowrap class="title"><b>Tên sản phẩm</b></td>
69 <td align="center" nowrap class="title"><b>Thứ tự sắp xếp</b></td>
70 <td align="center" nowrap class="title"><b>Không hiển thị</b></td>
71 <td align="center" nowrap class="title"><b>Ngày</b></td>
72 <td align="center" nowrap class="title"><b>Ngôn ngữ</b></td>
73
74 </tr>
75
76 <?
77 $sql="select *,DATE_FORMAT(pro_dateadded,'%d/%m/%Y %h:%m') as dateformat from pro_saleoff order by pro_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
78 $result=mysql_query($sql,$con);
79 $i=0;
80 while(($row=mysql_fetch_array($result)))
81 {
82 $i++;
83 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
84 $proinfo=GetProductInfo($row['products_id']);
85 ?>
86
87 <tr>
88 <td width="20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
89 <input type="checkbox" name="chk[]" value="<? echo $row['pro_id']; ?>"></td>
90 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
91 <a href="./?act=pro_saleoff_m&id=<? echo $row['pro_id']; ?>&page=<? echo $page?>">Sửa</a></td>
92 </td>
93 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
94 <a onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" href="./?act=pro_saleoff&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['pro_id']; ?>">Xoá</a></td>
95 <td width="20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['products_id']; ?> </td>
96 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $proinfo['products_name']; ?> </td>
97 <td width="80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['pro_sortorder']; ?> </td>
98 <td width="80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['pro_status']; ?> </td>
99 <td width="100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['dateformat']; ?> </td>
100 <td width="100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['language']; ?> </td>
101
102 </tr>
103 <?
104 }
105 ?>
106 </table>
107 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button" style="padding: 0">
108 <input type="hidden" name="act" value="pro_saleoff">
109 </form>
110 <script language="JavaScript">
111 function chkallClick(o) {
112 var form = document.frmList;
113 for (var i = 0; i < form.elements.length; i++) {
114 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
115 form.elements[i].checked = document.frmList.chkall.checked;
116 }
117 }
118 }
119 </script>
2 <tr align=center>
3 <td class="title" width="100%" height="17">
4 Sản phẩn bán chạy : </td>
5 </tr>
6 </table>
7 <?
8 switch ($_GET['action'])
9 {
10 case 'del' :
11 $id = $_GET['id'];
12 $sql = "delete from pro_saleoff where pro_id='".$id."'";
13 @$result = mysql_query($sql,$con);
14 if ($result) echo "<p align=center class='err'>Đã xóa thành công</p>";
15 else echo "<p align=center class='err'>Không thể xóa dữ liệu</p>";
16 break;
17 }
18 ?>
19
20 <?
21 if (isset($_POST['ButDel'])) {
22 $cnt=0;
23 foreach ($_POST['chk'] as $id)
24 {
25 @$result = mysql_query("delete from pro_saleoff where pro_id='".$id."'",$con);
26 if ($result) $cnt++;
27 }
28 echo "<p align=center class='err'>Đã xóa ".$cnt." phần tử</p>";
29 }
30 ?>
31 <?
32 $page = $_GET["page"];
33 $p=0;
34 if ($page!='') $p=$page;
35 ?>
36 <form method="POST" action="<? echo $_SERVER[PHP_SELF]; ?>" name="frmList">
37 <input type=hidden name="page" value="<? echo $page; ?>">
38 <?
39 function taotrang($sql,$link,$nitem,$itemcurrent)
40 { global $con;
41 $ret="";
42 $result = mysql_query($sql, $con) or die('Error' . mysql_error());
43 $value = mysql_fetch_array($result);
44 $plus = (($value['cnt'] % $nitem)>0);
45 for ($i=0;$i<($value[0] / $nitem) + plus;$i++)
46 {
47 if ($i<>$itemcurrent) $ret .= "<a href=\"".$link.$i."\" class=\"lslink\">".($i+1)."</a> ";
48 else $ret .= ($i+1)." ";
49 }
50 return $ret;
51 }
52 $pageindex=taotrang("select count(*) from pro_saleoff ","./?act=pro_saleoff&cat=".$_REQUEST['cat']."&page=",$MAXPAGE,$page);
53 ?>
54
55 <table cellspacing="0" cellpadding="0" width="100%">
56 <? if ($_REQUEST['code']==1) echo '<tr><td colspan="2" align="center" class="err">Đã cập nhật thành công</td></tr>'; ?>
57 <tr>
58 <td class="smallfont">Trang : <? echo $pageindex; ?></td>
59 </tr>
60 </table>
61
62 <table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#C9C9C9" width="100%" id="AutoNumber1">
63 <tr>
64 <td align=center nowrap class="title"><input type="checkbox" name="chkall" onclick="chkallClick(this);"></td>
65 <td nowrap class="title"> </td>
66 <td nowrap class="title"> </td>
67 <td align="center" nowrap class="title"><b>Mã </b></td>
68 <td align="center" nowrap class="title"><b>Tên sản phẩm</b></td>
69 <td align="center" nowrap class="title"><b>Thứ tự sắp xếp</b></td>
70 <td align="center" nowrap class="title"><b>Không hiển thị</b></td>
71 <td align="center" nowrap class="title"><b>Ngày</b></td>
72 <td align="center" nowrap class="title"><b>Ngôn ngữ</b></td>
73
74 </tr>
75
76 <?
77 $sql="select *,DATE_FORMAT(pro_dateadded,'%d/%m/%Y %h:%m') as dateformat from pro_saleoff order by pro_id limit ".($p*$MAXPAGE).",".$MAXPAGE;
78 $result=mysql_query($sql,$con);
79 $i=0;
80 while(($row=mysql_fetch_array($result)))
81 {
82 $i++;
83 if ($i%2) $color="#d5d5d5"; else $color="#e5e5e5";
84 $proinfo=GetProductInfo($row['products_id']);
85 ?>
86
87 <tr>
88 <td width="20" align="center" bgcolor="<? echo $color; ?>" class="smallfont">
89 <input type="checkbox" name="chk[]" value="<? echo $row['pro_id']; ?>"></td>
90 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
91 <a href="./?act=pro_saleoff_m&id=<? echo $row['pro_id']; ?>&page=<? echo $page?>">Sửa</a></td>
92 </td>
93 <td width="20" bgcolor="<? echo $color; ?>" class="smallfont">
94 <a onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" href="./?act=pro_saleoff&action=del&page=<? echo $_REQUEST['page']; ?>&id=<? echo $row['pro_id']; ?>">Xoá</a></td>
95 <td width="20" bgcolor="<? echo $color; ?>" align="left" width="55" align="left" class="smallfont"><? echo $row['products_id']; ?> </td>
96 <td bgcolor="<? echo $color; ?>" class="smallfont"><? echo $proinfo['products_name']; ?> </td>
97 <td width="80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['pro_sortorder']; ?> </td>
98 <td width="80" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['pro_status']; ?> </td>
99 <td width="100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['dateformat']; ?> </td>
100 <td width="100" bgcolor="<? echo $color; ?>" class="smallfont"><? echo $row['language']; ?> </td>
101
102 </tr>
103 <?
104 }
105 ?>
106 </table>
107 <input type="submit" value="Xóa Chọn" name="ButDel" onclick="return confirm('Bạn có chắc chắn muốn xoá ?');" class="button" style="padding: 0">
108 <input type="hidden" name="act" value="pro_saleoff">
109 </form>
110 <script language="JavaScript">
111 function chkallClick(o) {
112 var form = document.frmList;
113 for (var i = 0; i < form.elements.length; i++) {
114 if (form.elements[i].type == "checkbox" && form.elements[i].name!="chkall") {
115 form.elements[i].checked = document.frmList.chkall.checked;
116 }
117 }
118 }
119 </script>